<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <!-- BootStrap不支持IE的兼容模式,下面代码为了代码在IE下运行最新的渲染模式 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <!-- 在移动设备浏览器上，通过为视口（viewport）设置 meta 属性为 user-scalable=no 可以禁用其缩放（zooming）功能。 -->
  <!-- 这样禁用缩放功能后，用户只能滚动屏幕，就能让你的网站看上去更像原生应用的感觉。 -->
  <!-- width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no -->
  <!-- 初始化移动设备的浏览 width=device-width 视口的宽度等于设备宽度，initial-scale=1 缩放比例为1 -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>羽Libra::<sitemesh:title/></title>

  <!-- 加载图标 -->
  <link type="image/x-icon" href="${ctx}/static/images/logo/favicon.ico" rel="shortcut icon">

  <!-- 加载Bootstrap css 样式 -->
  <link href="${ctx}/static/bootstrap-3.3.5-dist/css/bootstrap.css" rel="stylesheet">

  <!-- 加载阿里巴巴矢量图标 http://www.iconfont.cn/ -->
  <link href="http://at.alicdn.com/t/font_1439283647_372718.css" rel="stylesheet">

  <!-- 加载字体样式 -->
  <link href="${ctx}/static/bootstrap-3.3.5-dist/fonts/define-font.css" rel="stylesheet">


  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- 使IE8支持HTML5标签 -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
  <!--[if lt IE 9]>
  <script src="${ctx}/static/support/html5shiv.min.js"></script>
  <script src="${ctx}/static/support/respond.min.js"></script>
  <![endif]-->

  <sitemesh:head/>
</head>

<body>
<!-- 头部导航条 -->
<%@ include file="/WEB-INF/layouts/header.jsp" %>
<sitemesh:body/>

<!-- 计算和上传时，整页遮罩，不可点击，等待加载完成 Modal -->
<!-- 通过 data-toggle="modal" data-target="#loading" 进行调用 -->
<div class="modal fade" data-backdrop="static" data-keyboard="false" id="loading" tabindex="-1" role="loading" aria-hidden="true">
  <div style="height:0px; width: 100%; top:40%; position:absolute;" align="center">
    <img src="${ctx}/static/images/loading/loading.gif" style="position:absolute; margin-left: -64px; ">
  </div>
</div>

<script type="text/javascript">
  <!-- 修改用户密码! -->
  function updatePassword() {
    $("#updatePassword .modal-body >.alert").remove();
    jQuery.ajax({
      url: "${ctx}/user/updatePassword",
      data: {
        "oldPassword": $("#oldPassword").val(),
        "newPassword": $("#newPassword").val(),
        "confirmPassword": $("#confirmPassword").val()
      },
      type: "post",
      dataType: "json",
      success: function (msg) {
        var alertStr = '';
        if (msg.status) {
          alert(msg.message);
          location.href = "${ctx}/logout";
        } else {
          alertStr = alertStr + '<div class="alert alert-warning alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span></button>';
          alertStr = alertStr + msg.message;
          alertStr = alertStr + '</div>';
          $("#updatePassword .modal-body").prepend(alertStr);
        }

        $("#updatePassword .modal-body").prepend(alertStr);

      },
      error: function (XMLHttpRequest, textStatus, errorThrown) {
        alert(XMLHttpRequest.status);
        alert(XMLHttpRequest.readyState);
        alert(textStatus);
      }
    });

  }
</script>

</body>
</html>